﻿using System.Windows.Forms;
using System.Globalization;
using System;

namespace client
{
    public class XYButton : Button
    {
        public byte x;
        public byte y;
        bool zajety;
        Statek mojStatek;

        public XYButton(byte x, byte y)
        {
            this.x = x;
            this.y = y;
            mojStatek = null;
        }

        public void zajmij(Statek ship)
        {
            if (!zajety)
            {
                zajety = true;
                mojStatek = ship;
                this.BackColor = System.Drawing.Color.YellowGreen;
            }
        }

        public bool czyZajety()
        {
            return zajety;
        }

        public void strzal()
        {
            if (this.zajety)
            {
                this.BackColor = System.Drawing.Color.DarkOrange;
                mojStatek.utrata();
            }
            else
            {
                this.BackColor = System.Drawing.Color.PaleTurquoise;
            }
        }

        public void zatop()
        {
            this.BackColor = System.Drawing.Color.Red;
        }
    }
}